﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using STT.Business;

namespace STT.Admin
{
    public class Methods
    {
        public static void ChucVu(ref DropDownList ddControl)
        {
            ddControl.DataSource = BTbChucVu.SelectAll();
            ddControl.DataTextField = "TenChucVu";
            ddControl.DataValueField = "MaChucVu";
            ddControl.DataBind();

            ddControl.Items.Insert(0, new ListItem { Text = "Chọn", Value = "-1" });
            ddControl.SelectedIndex = 0;
        }

        public static void DonVi(ref DropDownList ddControl)
        {
            ddControl.DataSource = BTbDonVi.SelectAll();
            ddControl.DataTextField = "TenDonVi";
            ddControl.DataValueField = "MaDonVi";
            ddControl.DataBind();

            ddControl.Items.Insert(0, new ListItem { Text = "Chọn", Value = "-1" });
            ddControl.SelectedIndex = 0;
        }

        public static void ChuyenMon(ref DropDownList ddControl)
        {
            ddControl.DataSource = BTbTDChuyenMon.SelectAll();
            ddControl.DataTextField = "TenTDChuyenMon";
            ddControl.DataValueField = "MaTDChuyenMon";
            ddControl.DataBind();

            ddControl.Items.Insert(0, new ListItem { Text = "Chọn", Value = "-1" });
            ddControl.SelectedIndex = 0;
        }

        public static void NgoaiNgu(ref DropDownList ddControl)
        {  
            ddControl.DataSource = BTbNgoaiNgu.SelectAll();
            ddControl.DataTextField = "TenNgoaiNgu";
            ddControl.DataValueField = "MaNgoaiNgu";
            ddControl.DataBind();

            ddControl.Items.Insert(0, new ListItem { Text = "Chọn", Value = "-1" });
            ddControl.SelectedIndex = 0;
        }

        public static void MonHoc(ref DropDownList ddControl)
        {
            ddControl.DataSource = BTbMonHoc.SelectAll();
            ddControl.DataTextField = "TenMonHoc";
            ddControl.DataValueField = "MaMonHoc";
            ddControl.DataBind();

            ddControl.Items.Insert(0, new ListItem { Text = "Chọn", Value = "-1" });
            ddControl.SelectedIndex = 0;
        }

        public static void Nganh(ref DropDownList ddControl)
        {
            ddControl.DataSource = BTbNganh.SelectAll();
            ddControl.DataTextField = "TenNganh";
            ddControl.DataValueField = "MaNganh";
            ddControl.DataBind();

            ddControl.Items.Insert(0, new ListItem { Text = "Chọn", Value = "-1" });
            ddControl.SelectedIndex = 0;
        }
        public static void PhongBan(ref DropDownList ddControl)
        {
            ddControl.DataSource = BTbPhongBan.SelectAll();
            ddControl.DataTextField = "TenPB";
            ddControl.DataValueField = "MaPB";
            ddControl.DataBind();

            ddControl.Items.Insert(0, new ListItem { Text = "Chọn", Value = "-1" });
            ddControl.SelectedIndex = 0;
        }
        public static void LoaiTinTuc(ref DropDownList ddControl)
        {
            ddControl.DataSource = BTbLoaiTinTuc.SelectAll();
            ddControl.DataTextField = "TenLoaiTT";
            ddControl.DataValueField = "MaLoaiTT";
            ddControl.DataBind();

            ddControl.Items.Insert(0, new ListItem { Text = "Chọn", Value = "-1" });
            ddControl.SelectedIndex = 0;
        }
        public static void Lop(ref DropDownList ddControl)
        {
            ddControl.DataSource = BTbLop.SelectAll();
            ddControl.DataTextField = "TenLop";
            ddControl.DataValueField = "MaLop";
            ddControl.DataBind();

            ddControl.Items.Insert(0, new ListItem { Text = "Chọn", Value = "-1" });
            ddControl.SelectedIndex = 0;
        }

        public static void HocVan(ref DropDownList ddControl)
        {
            ddControl.DataSource = BTbTDHocVan.SelectAll();
            ddControl.DataTextField = "TenTDHocVan";
            ddControl.DataValueField = "MaTDHocVan";
            ddControl.DataBind();

            ddControl.Items.Insert(0, new ListItem { Text = "Chọn", Value = "-1" });
            ddControl.SelectedIndex = 0;
        }
    }
}